package com.example.demo.rocketmq;

import lombok.Getter;
import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * <p>Description: RocketMQProperties配置</p>
 *
 * @author Eric Lee
 * @version v1.0.0
 * @since 2020/8/4 15:33
 **/
@Component
@Getter
@Setter
@ConfigurationProperties(prefix = "rocketmq")
public class RocketMQProperties {
    private final RocketMQConsumer consumer = new RocketMQConsumer();
    private final RocketMQProducer producer = new RocketMQProducer();

    @Setter
    @Getter
    public static class RocketMQConsumer {
        private String namesrvAddr;
        private String groupName;
        private String topic;
        private String tag;
        private int consumeThreadMin;
        private int consumeThreadMax;
    }

    @Setter
    @Getter
    public static class RocketMQProducer {
        private String namesrvAddr;
        private String groupName;
        private String instanceName;
        private int maxMessageSize;
        private int sendMsgTimeout;
        private Integer retryTimesWhenSendFailed = 2;
    }

}
